import Vue from 'vue';                            //核心
import App from './App.vue';                      //引入根组件
import VueRouter from 'vue-router';               //路由  
import 'mint-ui/lib/style.min.css';               //mintui.css
import mintUi from 'mint-ui';                     //mintui
import '../statics/css/mui.css'                   //mui样式
Vue.use(VueRouter);                               //全局挂载router
Vue.use(mintUi);                                  //全局挂载minUI插件
import resource from 'vue-resource';              //引入ajax
Vue.use(resource);                                //全局挂载ajax
import moment from 'moment';                      //引入时间处理插件moment
Vue.filter('datefmt',function(input,fmtstring){   //全局创建时间过滤器
    return moment(input).format(fmtstring);
})
import VuePreview from 'vue-preview'             //引入vue-preview插件并全局注册
Vue.use(VuePreview)


import '../statics/css/site.css'                  //引入全局样式

//引入各个组件
import home from './components/home.vue';
import shopCar from './components/shopCar/shopCar.vue';
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
import phonList from './components/photo/photoList.vue';
import photoInfo from './components/photo/photoInfo.vue';
import goodlist from './components/goods/goodlist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
//路由规则
var router = new VueRouter({
    linkActiveClass:'mui-active',
    routes:[
        {path:'/',redirect:'/home'},
        {path:'/shopCar',component:shopCar},
        {path:'/home',component:home},
        {path:'/news/newslist',component:newslist},
        {path:'/news/newsinfo/:id',component:newsinfo},
        {path:'/photo/photoList',component:phonList},
        {path:'/photo/photoInfo/:id',component:photoInfo},
        {path:'/goods/goodlist',component:goodlist},
        {path:'/goods/goodsinfo/:id',component:goodsinfo},

    ]
})
//根组件,Vue对象实例
new Vue({
    el:'#app',
    router:router,                             //把路由规则挂载到对象上
    render:c=>c(App)                           //根据App.vue创建一个根组件
})